﻿using System;
using Microsoft.Xna.Framework;
using OrganizedConfusion.Game_Objects;

namespace OrganizedConfusion
{
    public class ObjectFactory
    {
        public ObjectFactory() {}
        ObjectManager OM = ObjectManager.GetInstance();

        public void CreateBaseObject(Vector2 Pos, string Image)
        {
            BaseObject BO = new BaseObject();
            BO.LoadImage(Image);
            BO.Position = Pos;
            OM.AddObject(BO);
        }

        public void CreateProjectile(Vector2 Pos, string Image)
        {
            BaseObject Projectile = new BaseObject();
            Projectile.LoadImage(Image);
            Projectile.Position = Pos;
            Projectile.Type = (int)BaseObject.OBJ_TYPE.OBJ_PROJECTILE;
            OM.AddObject(Projectile);
        }

        public void CreatePlayer(Vector2 Pos, string Image, Vector2 Vel)
        {
            Player P = new Player();
            P.LoadImage(Image);
            P.Position = Pos;
            P.Velocity = Vel;
            P.Rotation = 0.0f;
            P.StartPos = Pos;
            OM.AddObject(P);
        }

        public void CreateBlock(Vector2 Pos, string Image)
        {
            Block BL = new Block();
            BL.LoadImage(Image);
            BL.Position = Pos;
            OM.AddObject(BL);
        }

        public void CreateSpikes(Vector2 Pos, string Image)
        {
            Spikes SP = new Spikes();
            SP.LoadImage(Image);
            SP.Position = Pos;
            OM.AddObject(SP);
        }

        public void CreateJumpBox(Vector2 Pos, string Image)
        {
            JumpBox JB = new JumpBox();
            JB.LoadImage(Image);
            JB.Position = Pos;
            OM.AddObject(JB);
        }

        public void CreateCheckpoint(Vector2 Pos, string Image)
        {
            CheckpointFlag CF = new CheckpointFlag();
            CF.LoadImage(Image);
            CF.Position = Pos;
            OM.AddObject(CF);
        }

        public void CreateFloor(Vector2 Pos, string Image)
        {
            Floor FL = new Floor();
            FL.LoadImage(Image);
            FL.Position = Pos;
            FL.ImageDimensions = new Vector2(FL.ImageDimensions.X, FL.ImageDimensions.Y * 0.5f);
            //FL.ChangeOrigin(new Vector2(FL.Origin.X, FL.ImageDimensions.Y * .75f));
            OM.AddObject(FL);
        }

        public void CreateLaunchCannon(Vector2 Pos, string Image, bool isFacingLeft)
        {
            LaunchCannon LC = new LaunchCannon();
            LC.LoadImage(Image);
            LC.Position = Pos;
            LC.IsFacingLeft = isFacingLeft;
            OM.AddObject(LC);
        }

        public void CreateRamp(Vector2 Pos, string Image, bool isFacingLeft)
        {
            Ramp RA = new Ramp();
            RA.LoadImage(Image);
            RA.Position = Pos;
            RA.IsFacingLeft = isFacingLeft;
            OM.AddObject(RA);
        }

        public void CreateTurret(Vector2 Pos, string Image, bool isFacingLeft)
        {
            Turret TU = new Turret();
            TU.LoadImage(Image);
            TU.Position = Pos;
            TU.IsFacingLeft = isFacingLeft;
            OM.AddObject(TU);
        }
    }
}
